<!DOCTYPE html>
<html>
<head>
    <title>应用市场</title>
    <link href="__PLUGIN_TMPL__/public/assets/layui/css/layui.css" rel="stylesheet" type="text/css">
    <link href="__PLUGIN_TMPL__/public/assets/layui/css/backend.min.css" rel="stylesheet" type="text/css">
    <include file='public/head'>
        <style>
            table th, table td{text-align: center;}
            .ml-10 { margin-left: 10px; }
			.layui-icon{font-size: 14px !important;}
			.layui-form-label{ width: auto;}
			.layui-btn.layui-btn-sm .fa{ font-size: 14px !important;}
			.mr4{ margin-right: 4px;}
			.layui-form-item{ margin-bottom: 0px;}
			.row{ margin: 0 !important;}
        </style>
</head>
<body>

	<div class="wrap js-check-wrap" style="padding: 20px 20px 0px 20px;">
	    <ul class="nav nav-tabs">
	        <php> $currentTab = 12 ;</php>
	        <include file="public/nav" />
	    </ul>
	</div>

    <div class="wrap js-check-wrap">
        <table class="table table-bordered table-hover margin-top-20">
            <thead>
                <tr class="theader">
                	<td width="50">序号</td>
                	<td width="150">模块标识</td>
                    <th width="150">标题</th>
					<th width="50">运行端</th>
                    <th width="250">简介</th>
                    <th width="60">价格</th>
                    <th width="60">开发者</th>
                    <th width="60">版本</th>
                    <th width="200">操作</th>
                </tr>
            </thead>
            <tbody class="table-body">
            	<volist name="list" id="vo">
	            	<tr>
	            		<td>{++$key}</td>
	            		<td>{$vo.name}</td>
	            		<td>{$vo.title}</td>
						<td>{$vo.type}</td>
	            		<td>{$vo.describe}</td>
	            		<td>
	            			<if condition = "$vo['price'] eq 0">
									免费
								<else>
									￥{$vo.price}
							</if>
	            		</td>
	            		<td>{$vo.author}</td>
	            		<td>{$vo.version}</td>
						<td>
							<if condition="cmf_auth_check(cmf_get_current_admin_id(),'plugin/appmarket/Template/particular')">
								<a href="{:cmf_plugin_url('Appmarket://Template/particular')}?id={$vo.id}" class="btn btn-info btn-sm">详情</a>
							</if>
							<if condition="cmf_auth_check(cmf_get_current_admin_id(),'plugin/appmarket/Template/pass')">
								<a href="{:cmf_plugin_url('Appmarket://Template/pass')}?id={$vo.id}" class="btn btn-success btn-sm zy-ajax-confirm">通过</a>
							</if>
							<if condition="cmf_auth_check(cmf_get_current_admin_id(),'plugin/appmarket/Template/refuse')">
								<a href="javascript:;" class="btn btn-danger btn-sm refuse-btn" onclick="refuseOperate({$vo.id},{$vo.step});">拒绝</a>
							</if>
						</td>
	            	</tr>
            	</volist>
            </tbody>
        </table>
        <empty name="list">
    		<tr>暂无数据~</tr>
    	</empty>
    </div>
<include file='public/scripts'>
<script src="__PLUGIN_TMPL__/public/assets/layui/layui.all.js"></script>
<script src="__STATIC__/js/custom/custom.js"></script>
<script>
//拒绝操作
var refuseOperate = function( id ){
	//iframe层-父子操作
	layer.open({
		type: 2,
		title:'驳回操作',
		area: ['80%', '80%'],
		fixed: false, //不固定
		maxmin: true,
		btn:['提交' , '取消'],
		content: '{:cmf_plugin_url("Appmarket://Template/refuse")}',
		yes:function( index ){
			let res = window["layui-layer-iframe" + index].callbackdata();
			if( res == false ){
				layer.msg( '请填写完整再提交。' );
				return false;
			}
			let url = '{:cmf_plugin_url("Appmarket://Template/refusePost")}';
			$.post( url , {id:id,content:res} ,function(data){
				let icon = (data.code==200)?1:5 ;
				layer.msg(data.message, {icon:icon});
				if( icon ==1 ){
					setTimeout(function(){
						window.location.reload();
					},1200);
				}	
			} , 'json' );
		}
	});
}


//layer弹窗
var layerMsg = function( data ){
	let icon = ( data.code != 0 ) ? 1 : 5;
	layer.msg( data.msg , { icon : icon } );
	if( icon == 1  ) {
		setTimeout( function(){ 
			if( data.url == '' ){
				window.location.reload();
			}else{
				window.location.href = data.url;
			}
		}, 1200 );
	}
}

</script>
</body>
</html>